package com.itheima.task.sms;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;

public class SMSDemo {
    public static void main(String[] args) {
        DefaultProfile profile = DefaultProfile.getProfile(
                "cn-hangzhou",
                "LTAI5t8zgTfRwifUV7PGaQ7a",
                "MtBnJgx5S2w9LnM2FHnN4mdhnVaVRB");
        IAcsClient client = new DefaultAcsClient(profile);
		
        CommonRequest request = new CommonRequest();
        request.setSysMethod(MethodType.POST);
        request.setSysDomain("dysmsapi.aliyuncs.com");
        request.setSysVersion("2017-05-25");
        request.setSysAction("SendSms");

        //----------------
        request.putQueryParameter("RegionId", "cn-hangzhou");
        request.putQueryParameter("PhoneNumbers", "15544667466");
        request.putQueryParameter("SignName", "ABC探花交友");
        request.putQueryParameter("TemplateCode", "SMS_205879117");
        request.putQueryParameter("TemplateParam", "{\"code:\"666888\"}");
        //----------------

        try {
            CommonResponse response = client.getCommonResponse(request);
            System.out.println(response.getData());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}